{
  "name": "Digital Feature Adoption Issue Tracking Agent",
  "nodes": [
    {
      "parameters": { "updates": ["message"] },
      "id": "tg-trigger-c9",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "name": "user_message", "value": "={{ $json.message.text }}", "type": "string" },
            { "name": "user_name", "value": "={{ $json.message.from.first_name + ' ' + ($json.message.from.last_name || '') }}", "type": "string" },
            { "name": "chat_id", "value": "={{ $json.message.chat.id }}", "type": "string" }
          ]
        }
      },
      "id": "set-c9",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [220, 0]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=User Name: {{ $json.user_name }}\nUser Message: {{ $json.user_message }}\nChat ID: {{ $json.chat_id }}",
        "options": {
          "systemMessage": "=You are a Digital Product Feature Adoption Issue Assistant.\n\nYour responsibilities:\n1. Identify whether the user wants to REGISTER a new feature adoption issue or CHECK the status of an existing issue.\n\n2. For new feature adoption issues, collect:\n   - Product Name\n   - Feature Name\n   - Expected Adoption Metric (e.g. DAU %, Feature Usage %)\n   - Actual Adoption Metric\n   - Brief description or hypothesis\n\n3. Validate the product using the Product Master Tool and extract:\n   - Product_Name\n   - Product_Owner_Email (used for email communication)\n   - Product_Status\n\n4. If the product is valid and active:\n   - Generate a unique issue reference ID in the format:\n     FTR-YYYYMMDD-[last 4 chars of feature]-HHmmss\n   - Register the issue using the Feature Adoption Register Tool\n   - Send an acknowledgement email using the Gmail Tool to Product_Owner_Email\n   - Clearly explain analysis and prioritisation workflow\n   - Respond using the Telegram Response Tool\n\n5. If the product is invalid or inactive:\n   - Politely explain the reason\n   - Do NOT register the issue\n   - Respond using the Telegram Response Tool\n\n6. For status checks:\n   - Ask for issue reference ID if missing\n   - Retrieve current status using the Feature Adoption Status Tool\n   - Explain the current analysis stage and next steps\n   - Respond using the Telegram Response Tool\n\nStrict rules:\n- Do NOT promise feature fixes or timelines.\n- Do NOT provide product strategy advice.\n- Product owner email must be retrieved from the master sheet only.\n- ALWAYS use the Telegram Response Tool."
        }
      },
      "id": "agent-c9",
      "name": "Feature Adoption Issue Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [500, 0]
    },
    {
      "parameters": {
        "model": { "mode": "id", "value": "gpt-4o" },
        "options": { "temperature": 0.2 }
      },
      "id": "llm-c9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [320, 220]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Workflow Configuration').item.json.chat_id }}"
      },
      "id": "memory-c9",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [500, 220]
    },
    {
      "parameters": { "descriptionType": "manual" },
      "id": "product-master-c9",
      "name": "Product Master Tool",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [640, 260]
    },
    {
      "parameters": { "operation": "append", "descriptionType": "manual" },
      "id": "feature-register-c9",
      "name": "Feature Adoption Register Tool",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [800, 260]
    },
    {
      "parameters": { "descriptionType": "manual" },
      "id": "feature-status-c9",
      "name": "Feature Adoption Status Tool",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [960, 320]
    },
    {
      "parameters": {
        "sendTo": "={{ $fromAI('product_owner_email') }}",
        "subject": "={{ $fromAI('email_subject') }}",
        "message": "={{ $fromAI('email_body') }}"
      },
      "id": "gmail-c9",
      "name": "Feature Adoption Issue Notification Email",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [1120, 220]
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}"
      },
      "id": "tg-response-c9",
      "name": "Send Telegram Response",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [960, 0]
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [[{ "node": "Workflow Configuration", "type": "main" }]]
    },
    "Workflow Configuration": {
      "main": [[{ "node": "Feature Adoption Issue Agent", "type": "main" }]]
    },
    "Feature Adoption Issue Agent": {
      "main": [[{ "node": "Send Telegram Response", "type": "main" }]]
    }
  },
  "active": false
}
